import java.util.*;

public class Main {

    //strExc:7_This_is_a_test    strAct:_hs_s_a_es
    public static void func(String strExc,String strAct){
        Set<Character> set = new HashSet<>();
        Set<Character> broken = new HashSet<>();
        for(char ch:strAct.toCharArray()){
            set.add(ch);
        }
        for(char c:strExc.toCharArray()){
            if(!set.contains(c) && !broken.contains(c)){
                broken.add(c);
                System.out.print(c);
            }
        }
        
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String strExc = in.nextLine().toUpperCase();
        String strAct = in.nextLine().toUpperCase();
        func(strExc,strAct);
    }
}